import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 屏蔽 ResizeObserver 警告，开发阶段，暂时不屏蔽
// const resizeObserverErr = 'ResizeObserver loop completed with undelivered notifications.';
// window.addEventListener('error', (e) => {
//   if (e.message === resizeObserverErr) {
//     e.stopImmediatePropagation();
//   }
// });

// window.addEventListener('unhandledrejection', (e) => {
//   const reason = e.reason?.message || '';
//   if (reason.includes('ResizeObserver')) {
//     e.preventDefault();
//   }
// });



app.use(router)
app.use(ElementPlus)
app.mount('#app')